package com.xinan.dmgl.cggl;

import com.jfinal.ext.plugin.tablebind.TableBind;
import com.jfinal.kit.StringKit;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;

import java.util.List;

@TableBind(tableName = "cggl_wplb")
public class CgglWplb extends Model<CgglWplb>{
    public static final CgglWplb dao = new CgglWplb();

    //columns START
    private String ID = "id";  //
    private String SJ_LBID = "sj_lbid";  //
    private String DSPORDER = "dsporder";  //显示顺序
    private String LBMC = "lbmc";  //类别名称
    private String BZ = "bz";  //备注
    private String YXBZ = "yxbz";  //有效标志
    private String LBBH="lbbh";  //类别编号

    public void setId(int value) {
        set(ID, value);
    }

	public int getId() {
		return get(ID);
	}

    public void setDsporder(int value) {
        set(DSPORDER, value);
    }

	public int getDsporder() {
		return get(DSPORDER);
	}

    public void setBz(String value) {
        set(BZ, value);
    }

	public String getBz() {
		return get(BZ);
	}
    public void setYxbz(String value) {
        set(YXBZ, value);
    }

	public String getYxbz() {
		return get(YXBZ);
	}

    public String getSJ_LBID() {
        return SJ_LBID;
    }

    public void setSJ_LBID(String SJ_LBID) {
        this.SJ_LBID = SJ_LBID;
    }

    public String getLBMC() {
        return LBMC;
    }

    public void setLBMC(String LBMC) {
        this.LBMC = LBMC;
    }
	//columns END
    public List<Record> findtree(String where) {
        return  Db.find("select *,lbmc as name, sj_lbid as pId from cggl_wplb " + where);
    }

    public List<CgglWplb> findAll() {
        return find("select * from cggl_wplb");
    }

    public Page<CgglWplb> page(int pageNumber, int pageSize, String where) {
        String sqlExp = "from cggl_wplb";
        if(StringKit.notBlank(where)){
            sqlExp += " where " + where;
        }
        return paginate(pageNumber, pageSize, "select *", sqlExp);
    }


    public String getLBBH() {
        return LBBH;
    }

    public void setLBBH(String LBBH) {
        this.LBBH = LBBH;
    }
}

